package kr.hkit.powerjava.chapter22.work3;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Programming5 {
	ArrayList<Double> score = new ArrayList<>();

	public boolean checkScore(double score) {
		return score >= 0.0 && score <= 10.0;

	}

	public void inputScore() {
		Scanner input = new Scanner(System.in);
		int i = 1;
		double temp;
		while (score.size() < 10) {
			System.out.printf("%d번째 심사위원의 점수를 입력하시오: ", i);
			temp = input.nextDouble();
			if (checkScore(temp)) {
				score.add(temp);
				i++;
			} else {
				System.out.println("점수는 0.0~10.0까지 가능합니다");
			}
		}
	}

	public double totalScore() {
		double total = 0;
		for (int i = 0; i < score.size(); i++) {
			if (score.get(i) == Collections.max(score)
					|| score.get(i) == Collections.min(score))
				continue;
			total += score.get(i);
		}
		return total;
	}
}
